<?php
session_start();
require("../bin/common.php");

//Check if install mode is not running
$installdata = file_get_contents("../lib/installdata.txt") or exit("Cannot open installdata.txt");
if ($installdata == "true") {
	checkSess();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Setup Control Panel - Vanadium Patch Mananger</title>
<link href="../lib/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../lib/script.js"></script>
<script type="text/javascript">
var stopbr = 0;
function dispPatchno() {
	document.getElementById('patch_no').style.visibility = "visible";
	if (stopbr == 0) {
		document.getElementById('patch_no').innerHTML = document.getElementById('patch_no').innerHTML + "<br /><br />";
		stopbr++;
	}
}

function remPatchno() {
	document.getElementById('patch_no').style.visibility = "hidden";
	document.getElementById('patch_no').value = "";
}
</script>
</head>
<body onload="fixSize()" onresize="fixSize()">

<div class="container" id="container">

	<!-- Header -->
	<div class="top">
	Vanadium Patch Manager

	<?php
	dispLogin();
	?>
	</div>
    
	<!-- Left Hand Panel -->
	<div class="left">
		<br /><span class="nav_option"><img src="../lib/gfx/icon_home.gif" width="15" height="15" alt="Home" /> <a href="../home/">Home</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_add.gif" width="12" height="12" alt="Add" /> <a href="../addpatch/">Add Patch</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_edit.gif" width="13" height="16" alt="Edit" /> <a href="../patch/changelog.php">View Changelog</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_edit.gif" width="13" height="16" alt="Edit" /> <a href="../editpatch/">Edit Patch Home</a></span><br /><br />
		<span class="nav_tab_option"><img src="../lib/gfx/icon_setup.gif" width="14" height="16" alt="Setup" /> <a href="../setup/">Setup</a></span><br /><br />
        <span class="nav_tab_tab_option"><img src="../lib/gfx/icon_edit.gif" width="13" height="16" alt="Edit" /> <a href="../setup/neoncube.php">Neoncube.ini</a></span><br /><br />
        <span class="nav_tab_tab_option"><img src="../lib/gfx/icon_account.gif" width="14" height="14" alt="Accounts" /> <a href="../setup/accounts.php">Accounts</a></span><br /><br />
        <span class="nav_tab_tab_option"><img src="../lib/gfx/icon_cp.gif" width="16" height="16" alt="Control Panel" /> <a href="../setup/cpanel.php">Control Panel</a></span>
	</div>
    
	<!-- Body Content Container -->
	<div class="content_container" id="content_container">
    
		<!--Content Title -->
		<div class="content_title">
			Setup - Control Panel
		</div>
        
		<!--Content Body -->
		<div class="content_body">
			<?php
			//Check if has been full installed.
			$installdata = file_get_contents("../lib/installdata.txt") or exit("Cannot open installdata.txt");
			
			if ($installdata == "true") {
				echo "If you would like to reinstall the control panel, please click the button below:<br /><br />
				<form method=\"post\" action=\"reinstall.php\">
				<input type=\"hidden\" name=\"reinstall\" value=\"reinstall\" />
				<input type=\"submit\" value=\"Reinstall Control Panel\" style=\"color: #0a0a0a\" />
				</form>";
			}
			else {
				echo "Welcome to Vanadium Patch Manager - A Neoncube Patch Modification. Thank you for choosing to use our program, before you can use the Vanadium Patch manager we must get some information so we can install to suit your needs.<br /><br />
				<form method=\"post\" action=\"install.php\">
				
				<font style=\"font-size: 14px;\"><b>Patch Information:</b></font><br />
				Do you have any previous patches for your server?<br />
				<input type=\"radio\" name=\"previouspatch\" value=\"yes\" onclick=\"dispPatchno();\" /> Yes<br />
				<input type=\"radio\" name=\"previouspatch\" value=\"no\" onclick=\"remPatchno();\" /> No<br /><br />
				
				<span id=\"patch_no\" style=\"visibility: hidden\">Since you have previous patches for your server, what was your previous patchlist.txt file? (values <b>MUST</b> be seperated by tabs and each patch must be on a new line)<br />
				<textarea name=\"patch_no\" style=\"color: #0a0a0a\" cols=\"45\" rows=\"5\"></textarea></span><br />
				
				<font style=\"font-size: 14px;\"><b>Account Information:</b></font><br />
				What is your desired username?<br />
				<input type=\"text\" name=\"username\" id=\"username\" style=\"color: #0a0a0a\" /><br /><br />
				What is your desired password?<br />
				<input type=\"text\" name=\"password\" id=\"password\" style=\"color: #0a0a0a\" /><br /><br />
				You may add more accounts later.<br /><br />
				<input type=\"submit\" value=\"Install\" style=\"color: #0a0a0a\" />
				</form>";
			}
			?>
        </div>
        
	<!--End Content Container-->
	</div>
    
	<!--Footer -->
	<div class="footer">
		Vanadium Patch Manager, A Neoncube Patch Modification.<br />
		GNU General Public License v3 - 2010<br />
		http://code.google.com/p/vanadiumpatch/
	</div>

<!--End Container-->
</div>
</body>
</html>